package wangwenjun.phase2.concurrencypattern.eventbus.google.demo01;

import com.google.common.eventbus.Subscribe;
import lombok.extern.slf4j.Slf4j;
import util.ThreadUtil;

import java.util.concurrent.ThreadLocalRandom;

/**
 * @author ChangLiang
 * @date 2020/6/19
 */
@Slf4j
public class SimpleListener {

    @Subscribe
    public void doAction(Integer itemId) {
        if (log.isDebugEnabled()) {
            ThreadUtil.sleepForMilliSeconds(ThreadLocalRandom.current().nextInt(200,1000));
            log.debug("Received event [{}] and will do action", itemId);
        }
    }
}
